//
//  BaseView.m
//  DailyRecord
//
//  Created by Gin on 2022/3/25.
//

#import "BaseView.h"

@implementation BaseView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self initUI];
        [self setUpContraints];
    }
    return self;
}

- (void)initUI{}

- (void)setUpContraints{}

//fullscreen
- (void)showInView:(UIView *)view{
    [view addSubview:self];
    [self mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(UIEdgeInsetsZero);
    }];
}

//no full view
- (void)showInViewNoCoverNavigationAndTabbar:(UIView *)view{
    [view addSubview:self];
    [self mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(kNavigationBarHeight);
        make.bottom.equalTo(view.mas_bottom).offset(-kTabbarHeight);
    }];
}

- (void)showInViewNoCoverNavigation:(UIView *)view{
    [view addSubview:self];
    [self mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(kNavigationBarHeight);
        make.bottom.equalTo(view);
    }];
}

@end
